using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using PccCommonForC;

public partial class Pub_Module_ProductImages : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindData();
        }
    }

    private void BindData()
    {
        DataTable dt = new DataTable();
        if (Request.QueryString["PDID"] != "" && Request.QueryString["PDID"] != null)
        {
            clsWebShop cls = new clsWebShop();
            PccMsg msg = new PccMsg();
            msg.CreateFirstNode("PDID", Request.QueryString["PDID"]);
            dt = cls.Get_Product_IMGByCondition(msg.GetXmlStr).Tables[0];

            if (dt.Rows.Count > 0)
            {
                dtlMaster.DataSource = dt;
                dtlMaster.DataBind();
            }
            else
            {
                lblEmpty.Visible = true;
            }
            

        }
       
    }
    protected void dtlMaster_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            Image imgPD = (Image)e.Item.FindControl("imgPD");
            string sURL=DataBinder.Eval(e.Item.DataItem,"ImgPD_Url").ToString();
            if (sURL.IndexOf("http://") == -1)//Khong tim thay
            {
                 sURL= ResolveUrl("~/") + sURL;
            }
            imgPD.ImageUrl = sURL;
        }
    }
}
